const app = getApp();
Page({
  data: {
    stateMapList: {
      "0": "未审批",
      "1": "已通过",
      "2": "未通过"
    },
    listOrder: [],
    loading: true
  },
  onLoad(options) {
    let that = this;
    wx.request({
      url: 'https://xuexiwuapi.jomoit.com/visitor-api/system/data/list/beVisited',
      method: 'GET', 
      header: {
        "Content-Type": "application/json",
        Authorization: 'Bearer ' + app.globalData.token
      },
      data: {
        pageNum: 1,
        pageSize: 10
      },
      success: function(res) {
        const { data } = res;
        const { code, msg, rows, total } = data;
        that.setData({ 
          listOrder: rows,
          loading: false
        })
      },
      fail: (err) => {
        that.setData({ loading: false });
        console.error("接口请求失败", err);
      }
    })
  },
  onCheckDetail(item) {
    const id = item?.currentTarget?.dataset?.id;
    wx.navigateTo({
      url: '/pages/reviewOrder/reviewOrder',
      success:(res)=>{
        res.eventChannel.emit('params',{ id })
      }
    })
  }
})